﻿using Pay.DTO;
using Pay.IService;
using Pay.TO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Pay.Web.Areas.Admin.Controllers
{
    /// <summary>
    /// 分佣发起
    /// </summary>
    [RouteArea("admin")]
    [RoutePrefix("tokenbill")]
    public class TokenBillController  : AdminController {
        private ITokenBillService _iTokenBillService;

        public TokenBillController(ITokenBillService iTokenBillService) {
            _iTokenBillService = iTokenBillService;
        }
        [HttpGet]
        public JsonResult Gets(TokenBillQuery query) {
            var result = _iTokenBillService.Gets(query);
            return Json(ResultToJson.Json(result), JsonRequestBehavior.AllowGet);
        }
        [HttpGet]
        public JsonResult GetBill(long id) {
            var result = _iTokenBillService.GetBill(id);
            return Json(ResultToJson.Json(result), JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 系统确认收益
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost]
        public JsonResult ConfirmBill(long id) {
            var result = _iTokenBillService.SysConfirmUserBill(id, currentUser.user_id);
            return Json(ResultToJson.Json(result?"确认成功":"确认失败",result), JsonRequestBehavior.AllowGet);
        }
    }
}